﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ToracTechnologies.ExpressionTree.Testing
{

    #region Class Definition

    [Serializable()]
    public class Jason : ITest
    {

        #region Properties

        [thisAttribute("t1")]
        public int Id { get; set; }

        public string txt { get; set; }

        public Nullable<int> IdNull { get; set; }

        /// <summary>
        /// For Cloning Test
        /// </summary>
        public Jason NestedObject { get; set; }

        public string duplicateTxt { get; set; }

        public List<Jason> DummyList { get; set; }

        #endregion

        #region Static Methods

        public static IEnumerable<Jason> CreateDummyList(int HowManyItems)
        {
            List<Jason> lst = new List<Jason>();

            for (int i = 0; i < HowManyItems; i++)
            {
                var j = new Jason() { Id = i, txt = "Test_" + i.ToString() };

                j.duplicateTxt = "Dup";
                j.NestedObject = new Jason() { Id = i + 10000 };

                if (i == 1)
                {
                    j.IdNull = i;
                    j.duplicateTxt = "Dup = 1";
                }

                lst.Add(j);
            }

            return lst;
        }

        public static Jason CreateDummyRecord()
        {
            return CreateDummyList(1).ElementAt(0);
        }

        #endregion

    }

    #endregion

    #region Attributes

    public class thisAttribute : Attribute
    {
        public thisAttribute(string t)
        {
            thisAttributeText = t;
        }

        public string thisAttributeText { get; set; }
    }

    #endregion

    #region Interface

    public interface ITest
    {
        int Id { get; set; }
    }

    #endregion

}
